<template>
  <div class="recommend">
    <div class="recommenditem" v-for="(item, index) in recommends" :key="index">
      <a :href="item.link">
        <img :src="item.image" alt="" />
        <span>{{ item.title }}</span>
      </a>
    </div>
  </div>
</template>

<script>
import { getHomeMultidata } from "../../network/home.js";
export default {
  name: "recommend",
  data() {
    return {
      recommends: [],
    };
  },
  created() {
    // 1.请求多个数据
    this.getHomeMultidata();
  },
  //网络请求
  methods: {
    getHomeMultidata() {
      getHomeMultidata().then((res) => {
        this.recommends = res.data.recommend.list;
        console.log(res.data.recommend.list);
      });
    },
  },
};
</script>

<style>
.recommend {
  display: flex;
  text-align: center;
}
.recommenditem {
  width: 90px;
  height: 90px;
  margin: 20px auto;
}
.recommenditem img {
  width: 100%;
  height: 100%;
}
.recommenditem span {
  font-size: 16px;
  color: #ec7259;
}
</style>